import { getMoviesDataApi, getPullDataApi } from "../../utils/api";

const actions = {
  // 异步请求首页电影列表数据
  getMoviesDataAsync({ commit }) {
    return new Promise((resolve) => {
      getMoviesDataApi().then((res) => {
        commit("getMoviesData", res);
        resolve();
      });
    });
  },

  // 异步请求上拉加载的电影数据
  getPullDataAsync({ commit }, payload) {
    return new Promise((resolve) => {
      getPullDataApi(payload).then((res) => {
        commit("getPullData", res);
        resolve();
      });
    });
  },
};

export default actions;
